import request from '@/config/axios'

// 会员机构 VO
export interface OrganizationVO {
  // 编号，主键自增
  id: number
  // 机构code
  code: string
  // 机构名称
  name: string
  // 父菜单ID
  parentId: number
  // 显示顺序
  sort: number
  // 菜单状态
  status: number
  // 门店地址
  address: string
}

// 会员机构 API
export const OrganizationApi = {
  // 查询会员机构列表
  getOrganizationList: async (params) => {
    return await request.get({ url: `/member/organization/list`, params })
  },

  // 查询会员机构详情
  getOrganization: async (id: number) => {
    return await request.get({ url: `/member/organization/get?id=` + id })
  },

  // 新增会员机构
  createOrganization: async (data: OrganizationVO) => {
    return await request.post({ url: `/member/organization/create`, data })
  },

  // 修改会员机构
  updateOrganization: async (data: OrganizationVO) => {
    return await request.put({ url: `/member/organization/update`, data })
  },

  // 删除会员机构
  deleteOrganization: async (id: number) => {
    return await request.delete({ url: `/member/organization/delete?id=` + id })
  },

  // 导出会员机构 Excel
  exportOrganization: async (params) => {
    return await request.download({ url: `/member/organization/export-excel`, params })
  },

  // 查询用户机构 - 精简信息列表
  getSimpleOrganizationList: async () => {
    return await request.get({ url: `/member/organization/list-all-simple` })
  },
    // 查询用户机构 - 精简信息列表
  getTopOrganizationList: async () => {
    return await request.get({ url: `/member/organization/getTopOrganization` })
  }
}